<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 
        weakset里面只能放对象
     -->
    <script>
        const arr = [[1, 2], [3, 4]]
        // weakset里面存的是数组的成员 而不是数组
        const ws = new WeakSet(arr)
        console.log(ws);


        /* 
            add
            has
            delete
            weakset不能遍历 并且没有foreach方法
        */
        const obj = {}
        ws.add(window);
        ws.add(obj);

        ws.has(window); // true
        console.log(ws.has(obj));    // true

        ws.delete(window);
        ws.has(window);    // false
    </script>
</body>

</html>